Create agents in 3D space

Author: Lukas Breitwieser
In this tutorial we want to demonstrate different functions to initialize agents in space.

Let's start by setting up BioDynaMo notebooks.

We use SphericalAgents with $diameter = 10$ for all consecutive examples.

We define the number of agents that should be created for functions that require this parameter.

We define two helper functions that reset the simulation to the empty state and one to visualize the result.

Create agents randomly inside a 3D cube

Cube: $x_{min} = y_{min} = z_{min} = -200$ and $x_{max} = y_{max} = z_{max} = 200$
By default a uniform random number distribution is used.

Create agents randomly inside a 3D cube using a gaussian distribution

Cube: $x_{min} = y_{min} = z_{min} = -200$ and $x_{max} = y_{max} = z_{max} = 200$
Gaussian: $\mu = 0$, $\sigma = 20$
Note the extra parameter $rng$ passed to CreateAgentsRandom

Create agents randomly inside a 3D cube using an exponential distribution

Cube: $x_{min} = y_{min} = z_{min} = -200$ and $x_{max} = y_{max} = z_{max} = 200$
Exponential: $\tau = 100$
Note the extra parameter $rng$ passed to CreateAgentsRandom

Create agents randomly inside a 3D cube using a 3D gaussian distribution

Cube: $x_{min} = y_{min} = z_{min} = -200$ and $x_{max} = y_{max} = z_{max} = 200$
3D gaussian: $\mu_x = \mu_y = \mu_z = 0$, $\sigma_x = 100$, $\sigma_y = 50$, $\sigma_z = 20$
The gaussian distribution we used earlier in this tutorial used the same parameters $\mu$ and $\sigma$ for all three dimentions. In this example we want to use different values for $\sigma$ in each dimension. Therefore we have to use a 3D guassian. Since BioDynaMo does not have a predefined 3D gaussian, we have to define the function ourselves.

Create agents randomly on a sphere

Center of the sphere ${0, 0, 0}$
Radius: 100

Create 3D grid of agents

Number of agents per dimension: 10
Space between agents: 20
With this parameters Grid3D will create 1000 agents.

Create agents on a surface

We create agents between $x_{min} = y_{min} = -100$ and $x_{max} = y_{max} = 100$ with spacing of 10 beween agents. The $z$-coordinate is defined by the function $f(x, y) = 10 * sin(x/20) + 10 * sin(y/20)$

Create agents on a surface randomly

We use the same parameters as in the example before, but this time we want to place agents randomly on this surface. Therefore, $x$, and $y$ coordinate are sampled from a uniform distribution between $x_{min} = y_{min} = -100$ and $x_{max} = y_{max} = 100$.